package version4.Client.netty.nettyInitializer;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import version4.Client.netty.handler.NettyClientHandler;
import version4.common.serializer.MyCode.MyDecoder;
import version4.common.serializer.MyCode.MyEncoder;
import version4.common.serializer.MySerializer.impl.JSONSerializer;


public class NettyClientInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        pipeline.addLast(new MyDecoder());
        pipeline.addLast(new MyEncoder(new JSONSerializer()));
        pipeline.addLast(new NettyClientHandler());
    }
}
